<?php

namespace common\logics;

use Yii;
use common\helpers\Url;

/**
 * This is the model class for table "{{%user_address}}".
 *
 * @property string $updated_at 最近更新时间
 */
class UserAddressLogic extends \common\models\user\UserAddress {

    public function getLink() {
        return Url::weblink('user/address/{id}', [
            'id' => $this->id
        ]);
    }

    public function fields() {
        return [
            'id',
            'name',
            'tel' => function() {
                return Yii::$app->formatter->asMaskMobile($this->mobile);
            },
            'province',
            'city',
            'country' => 'district',
            'address_detail',
            'area_code',
            'postal_code',
            'isDefault',
            'address',
            'link',
        ];
    }

}
